import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/brands',
    method: 'get',
    params: { params }
  })
}

export function getPagedList(params) {
  console.log(params)
  return request({
    url: '/brands/paged',
    method: 'post',
    data: params
  })
}

export function getBrand(id) {
  return request({
    url: `/brands/${id}`,
    method: 'get'
  })
}

export function createBrand(data) {
  return request({
    url: '/brands/add-new',
    method: 'post',
    data // data 表示将数据转换为 JSON 字符串，放到请求体中发送到后端
  })
}

export function updateBrand(id, data) {
  return request({
    url: `/brands/${id}/update`,
    method: 'post',
    data
  })
}

export function deleteBrand(id) {
  return request({
    url: `/brands/${id}/delete`,
    method: 'post'
  })
}

export function enableBrand(id) {
  return request({
    url: `/brands/${id}/enable`,
    method: 'post'
  })
}

export function disableBrand(id) {
  return request({
    url: `/brands/${id}/disable`,
    method: 'post'
  })
}
